package com.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000121693813";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDri2gd0xVhLZuwUUIqumdqePnDHLT4pYEdexd0Fm+zT9YJSwBTuLpP0DEl+u4+K2tnyZchwLuhXsutkjY5+kUHUGgmzzJQJ84ztwzFir1iWAhFtX2F+lKIPI0wGVw5H7xFybc4Z74PvhLt5HXAKiyztXhmpzYxhwt1ODWfmhOrqIVHBWt/iIbTd9QOkVTipF4AjrbeSH/D4mSZ6aWoIFnYGfQvIx+zBXwRh4Ec/OALLZUKEHz8eC6NcVjHNx5NimdcbaQlCWwCsq31SotWxJeATxnFbRUgB5PjL1hkbOsWFxn47W5bYNYz4pYYEV785hK/Y9+47ulpD2epbe4NZ3FfAgMBAAECggEAB+rwvgfpcRHSaPPiUINhlI+qfaeKYc1WcMJBgJJ8gL+PR1KxGR9di+9Ip6kutwJIov2Ayg6rf/oqyJPgpMRH674FMkDGxTEBWnWtxTorsZGZ/ZXjOUy314KJkHNZyUXK02G7efbqyaavBjYmyyXfyM6x1GmMhc+vT+pqywmn3Z5FECgreNmQ3hFB3S7RIiuYAalLRhBARGD9kUNSR9xEWORSGUPubPY+zSfwsH7q2IoN0InFzIg1pRsoaSHGjJumsL5FsNO5r35+hjnFVQXv3BB1w/WvQ/eW8GHrAy8E015aV9QTbVIwgHihm7ISv36EkCmy2iw3wBRF81+0SxLhuQKBgQD9k3YJK4R+bVIcsCfnlKOGryvRpR8OFlsuip//QXVzF0pU+bn5gHObYLjemYg9yxbrHeneCmPe0wO5SLMiVYSyWb3p26RLZhH7rmV4L9eA0z1ngwYfZaqzc1oKEyXcYhxswLxs+PrjfVXniDN3xRCJeuvvR1s2lEpS93YlOMo4owKBgQDty9HlhYPGb+Thu4d8wu/4heBJ0L+or5cFdN0q2pOi3vJeTEy3AGhNwruYWl1aYep29K6KsMVjNsppMVVsS28vyyULYuls7uFN6IB+FbJNaJZOY+7kzW/x/LDFiD0tzQ8LyhiwV949tHE/jE0tG5C8b1Fbe8t8aaA9hjLa+/zEFQKBgQDjkjOchzGhRPssQ+uMKhmYBh2NSGNWgTnTyxVMP7LoVz6ehIAjKuSVzXgcTi23R0yKNY5td2Wp1DbDUjtx1M4CQgfumPAZusDo3tqxwj3ln6679xrHkrZf1mY4JHcWEfbwowh3w/tlrlYqNFH8ax8sQuT7GU8C7JLHYs7lGNJjgQKBgF/ZN9F775GcqHUUUZhIOtHBpJYcPiSQIh9g64TKdZfApZC80G8zCtfNFjBivB4iOY+ZMIFWnzlObGfaKsRr43UwPM5KICx4XPg6LxCjTitFbNBMF47B/81aPSZhs8cyUE5AN5Nc14eno74pnzH/WmeZtwFY9LxBFwW1geoih8/BAoGAa7CsKI5p8S7WKnuES7mEFCWZGrGXwbZOuUwhiKAPl3QmHVDlDTmz6+jwvjcknpssjpsctFlGbYQ8hRJ+CCGO4MR8ELYI2M8MjC2mhT+n9Z35WRbOzgrqhu5r4dr4g9yrecWxtJmOKxDRyHdF3Ex7QM1ywezfRu0tmahOmKrepB0=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkEj3iwzWF9iu9unSH7Ts17avJsgYsydJ25jwUDT2VqBfIKrM2gnkYtOlVeFHVlcr/1yQcpW28GwbH9k0O0iHeWB+SgzkXcXghxvG3247O60e9G1dSFR8EI5ofFpPWbEPBIvu8GdlE0hxxEq5/NcsJ667d6ntLxujJT0ribt0EzrFzYeYAEstM3OQynw6/duYJUOH2S32ndMajdTYVkQWa2lIwByueQx3KeICzjMg8V1+00OGjwdGFqWP7YIvWdqQU9EDiLBZSCd6FFRLTJ7JocMAYUNvNJAyDOmG2EottNi/om3WoXGwxVND5yU2gfQ6kwR3Dqnnajqk3BQ3RsZu5wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://43.138.16.185:8080/getnotify";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

